joinedmenu: add helper to join menus instead of nesting
authorChristian Hergert <chergert@redhat.com>
Thu, 8 Jul 2021 21:16:06 +0000 (14:16 -0700)
committerChristian Hergert <chergert@redhat.com>
Thu, 8 Jul 2021 21:16:06 +0000 (14:16 -0700)
commitd63d9b231922725fbb2c58b443a0187435b66247
treea2da79ff106ba8a12769fd995ef467f4c9375df4
parent6818eee85900f2f50e99e5132d08b06ae12e823d
joinedmenu: add helper to join menus instead of nesting

In many cases, we have an "extra-menu" property that is used to allow
applications to join menus into the native menu for the widget. Previously,
this was done by nesting that menu in a section.

Doing so increases the complexity of the rules for GtkMenuTracker as you
may want different handling from inside of the section vs toplevel
sections.

If instead we synthetically glue the menus together, we have a much more
natural joining of menus as the application developer would expect for
their menu.

This also ports GtkLabel, GtkText, GtkPasswordEntry, and GtkTextView to
use the joined menu helper.

The joined menu helper comes originally from GNOME Builder and has had
extensive use there.

Fixes #4094
gtk/gtkjoinedmenu.c [new file with mode: 0644]
gtk/gtkjoinedmenuprivate.h [new file with mode: 0644]
gtk/gtklabel.c
gtk/gtkpasswordentry.c
gtk/gtktext.c
gtk/gtktextview.c
gtk/meson.build